﻿Imports System.Data
Imports System.Data.Sql
Imports System.Data.SqlClient
Public Class ketnoi
    Public Shared cnString = "Data Source=PC-PC\SQLEXPRESS;Initial Catalog=THUVIEN;Integrated Security=True;User ID=sa;Password = 123456;"
    Public Shared Function QR_SQL(ByVal strSQL As String) As DataTable
        Dim dttb As New DataTable()
        Dim cn As New SqlConnection(cnString)
        Dim cm As New SqlCommand
        cm.Connection = cn
        cm.CommandText = strSQL
        Dim dat As New SqlDataAdapter(cm)
        dat.Fill(dttb)
        Return dttb
    End Function
    Public Shared Function NonQR_SQL(ByVal strSQL As String) As String
        Try
            Dim cn As New SqlConnection(cnString)
            cn.Open()
            Dim cm As New SqlCommand
            cm.Connection = cn
            cm.CommandText = strSQL
            cm.ExecuteNonQuery()
            Return "true"
        Catch ex As Exception
            Return ex.ToString
        End Try
    End Function
End Class
